package com.SouthernWall_404.age_tool.common.event;

import com.SouthernWall_404.age_tool.AgeTool;
import com.SouthernWall_404.age_tool.common.API.Capability.Provider.TriggersCapProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class AttachCapabilityEvent {

    @SubscribeEvent
    public static void onAttachCapabilityEvent(AttachCapabilitiesEvent event)
    {
         if(event.getObject()instanceof Level level)
         {
             if (!level.isClientSide()) {
                 event.addCapability(
                         new ResourceLocation(AgeTool.MODID, "triggers_capability"),
                         new TriggersCapProvider()
                 );
             }
         }
    }
}
